<template>
	<view>
		<uni-popup ref="maintenanceCorePopup" height="200px" type="center" :animation="false">
			<view class="mypopup">
				<view class="mypopup__head">
					<image src="../../static/img/icon-clock.png"></image>
					<text>更换滤芯</text>
				</view>
				<view class="mypopup__body">
					<!-- 一行两个 -->
					<view class="ag-cellgroup" style="align-items:center;">
						<view class="ag-cell">
							<view class="ag-cell__label" style="margin-top: 5rpx">
								<text style="font-size: 22rpx;">滤芯类型：</text>
							</view>
							<view class="ag-cell__value">
								<picker mode="selector" :range="FilterTypeData" range-key="AppBrief" :value="FilterTypeIndex" @change="ChangeFilterType">
									<AGInput :disabled="true" customStyle="margin-top:-5rpx;" dropdown placeholder="滤芯类型" :value="FilterTypeData[FilterTypeIndex].AppBrief" />
								</picker>
							</view>
						</view>

						<view class="ag-cell">
							<view class="ag-cell__label" style="margin-top: -10rpx">
								<text style="font-size: 22rpx;">更换客户自购件：</text>
							</view>
							<view class="ag-cell__value" style="margin-top: -15rpx;">
								<switch />
							</view>
						</view>
					</view>
					<!-- 一行一个 -->
					<view class="ag-cell">
						<view class="ag-cell__label">
							<text>更换件：</text>
						</view>
						<view class="ag-cell__value">
							<AGInput customStyle="margin-top:-10rpx;" icon="search" placeholder="产品" @openSearch="" :value="001" :disabled="false" />
						</view>
					</view>
					<view class="ag-cell">
						<view class="ag-cell__label">
							<text>更换件信息：</text>
						</view>
						<view class="ag-cell__value">
							...
						</view>
					</view>

					<view class="ag-cell">
						图片
					</view>

					<view class="ag-cellgroup">
						<view class="ag-cell">
							<text>1</text>
						</view>
						<view class="ag-cell">2</view>
						<view class="ag-cell">3</view>
					</view>
					<view class="ag-cell">
						<view class="ag-cell__label">
							<text>提示信息：</text>
						</view>
					</view>
					<view class="ag-divider"></view>
					<view class="mypopup__footer">
						<button class="cu-btn lg primary plain" @click="closePoPup()">取消</button>
						<button class="cu-btn lg primary">确定</button>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@dcloudio/uni-ui/lib/uni-popup/uni-popup'
	import AGInput from '../AGInput/index'
	export default {
		components: {
			uniPopup,
			AGInput
		},
		data() {
			return {
				FilterTypeData: {},
				FilterTypeIndex: 0,
			}
		},
		mounted() {
			this.GetFilterType();
		},
		methods: {
			openPoPup() {
				this.$refs.maintenanceCorePopup.open();
			},
			closePoPup() {
				this.$refs.maintenanceCorePopup.close();
			},
			ChangeFilterType(e) {
				this.FilterTypeIndex = e.detail.value;
			},
			GetFilterType() {
				this.workordercompleteservice.GetFilterInfoAsync(this.UserInfo.mobile, this.UserInfo.RetId).then(result => {
					console.log(result);
					if (result.RetBool == true) {
						let data = JSON.parse(result.RetObject);
						this.FilterTypeData = data;
					} else {
						uni.showToast({
							title: result.RetMsg,
							icon: "none"
						});
					}
				});
			},
		}
	}
</script>
